numBands = 40;
range = [0,4000];
normalization = "bandwidth";
fftLength = 256;
fs=8000;
[fb,cf,bw] = designAuditoryFilterBank(fs, ...
                                   "FFTLength",fftLength, ...
                                   "NumBands",numBands, ...
                                   "FrequencyRange",range, ...
                                   "Normalization",normalization);

numPoints = size(fb,2);
F=1:numPoints;
plot(F,fb.');
grid on;
title("Mel Filter Bank");
xlabel("Frequency (Hz)");
saveas(gcf,"mel-fbank","jpg");
format short
writematrix(fb,"mel-fbank-fb.txt",'delimiter','tab');
writematrix(cf,"mel-fbank-cf.txt",'delimiter','tab');
writematrix(bw,"mel-fbank-bw.txt",'delimiter','tab');
%fp=fopen("mel-fbank.txt","w");
%fprintf(fp,"%f",fb);
%fclose(fp);


